﻿using MyToDo.Common.Models;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;

namespace MyToDo.ViewModels
{
    public class IndexViewModel : BindableBase
    {
        public IndexViewModel()
        {
            taskBars = new ObservableCollection<TaskBar>();
            ToDoItems = new ObservableCollection<ToDoItem> ();
            MemoItems = new ObservableCollection<MemoItem> ();
            
            
            CreateTaskBar();
            Create_ToDo_Test();

        }
        private ObservableCollection<TaskBar> taskBars;
        public ObservableCollection<TaskBar> TaskBars
        {
            get { return taskBars; }
            set { taskBars = value;RaisePropertyChanged(); }
        }

        private ObservableCollection<ToDoItem> toDoItems;
        public ObservableCollection<ToDoItem> ToDoItems
        {
            get { return toDoItems; }
            set { toDoItems = value; RaisePropertyChanged(); }
        }

        private ObservableCollection<MemoItem> memoItems;

        public ObservableCollection<MemoItem> MemoItems
        {
            get { return memoItems; }
            set { memoItems = value; RaisePropertyChanged(); }
        }

        void CreateTaskBar()
        {
            TaskBars.Add(new TaskBar (){Icon = "CalendarClock", Color = "#99CC99", Content = "9",Target = "",Title = "汇总" });
            TaskBars.Add(new TaskBar (){Icon = "AlarmCheck", Color = "#99CCFF", Content = "9",Target = "",Title = "已完成" });
            TaskBars.Add(new TaskBar (){Icon = "ClipboardTextClock", Color = "#0066CC", Content = "100%",Target = "",Title = "完成率" });
            TaskBars.Add(new TaskBar (){Icon = "ClockEditOutline", Color = "#CC0033", Content = "19",Target = "",Title = "备忘录" });

        }

        void Create_ToDo_Test()
        {
            for(int i = 0; i < 10; i++)
            {
                ToDoItems.Add(new ToDoItem() { Title = "todo标题"+i, Content = "todoContent" });
                MemoItems.Add(new MemoItem() { Title = "Memo标题"+i , Content = "MemoContent"});
            }

        }
    }
}
